#include "csapp.h"

int main() 
{
    pid_t pid;
    int x = 1;

    pid = Fork(); //返回两个进程，父进程为main进程，子进程中变量x=1；通过fork返回的值判断当前进程是父进程还是子进程;
    printf("pid %d\n",pid);
    if (pid == 0) {  //子进程返回的pid为0；父进程返回子进程的pid;
	printf("child : x=%d\n", ++x); 
	exit(0);
    }
    printf("parent: x=%d\n", --x); 
    exit(0);
}
